﻿using UnityEngine;
using System.Collections;

namespace win {
	public class Main : MonoBehaviour {

		void OnMouseDown() {
			toIndexAfterSec (0.5f);
		}

		void toIndexAfterSec(float s) {
			StartCoroutine (toIndex (s));
		}
		
		// s秒后回到Index
		IEnumerator toIndex(float s) {
			yield return new WaitForSeconds(s);
			
			Application.LoadLevel("index");
		}

		// Use this for initialization
		void Start () {
			object[] gameObjects;
			gameObjects = GameObject.FindSceneObjectsOfType(typeof(Transform));
			foreach (Transform go in gameObjects)
			{
				if(!go.tag.Equals("CANNOT_DESTROY")&&(!go.tag.Equals("MainCamera"))){
					Network.Destroy(go.networkView.viewID);
				}
			}
		}
		
		// Update is called once per frame
		void Update () {
		
		}
	}
}